﻿using System;

namespace DesignModeConsole.OOPAndPOP
{
    /*
     多用组合少用继承：因为有些继承层次过深
     */

    /// <summary>
    /// 鸟儿飞
    /// </summary>
    public interface IFlyable
    {
        void Fly();
    }

    public class Flyable : IFlyable
    {
        public void Fly()
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    /// 鸟儿叫
    /// </summary>
    public interface ITweetable
    {
        void Tweet();
    }

    public class Tweetable : ITweetable
    {
        public void Tweet()
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    /// 鸟儿下蛋
    /// </summary>
    public interface IEgglayable
    {
        void LayEgg();
    }

    public class Egglayable : IEgglayable
    {
        public void LayEgg()
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    /// 鸵鸟
    /// </summary>
    public class Ostrich : ITweetable, IEgglayable
    {
        private readonly Tweetable _tweet = new Tweetable();
        private readonly Egglayable _egglay = new Egglayable();

        public void LayEgg()
        {
            _egglay.LayEgg();
        }

        public void Tweet()
        {
            _tweet.Tweet();
        }
    }

    /// <summary>
    /// 麻雀
    /// </summary>
    public class Sparrow : IFlyable, ITweetable, IEgglayable
    {
        public void Fly()
        {
            throw new NotImplementedException();
        }

        public void LayEgg()
        {
            throw new NotImplementedException();
        }

        public void Tweet()
        {
            throw new NotImplementedException();
        }
    }
}